package com.cnblogs.hoojo.rapidframework.table;

import cn.org.rapid_framework.generator.provider.db.table.TableFactory;
import cn.org.rapid_framework.generator.provider.db.table.TableFactoryListener;
import cn.org.rapid_framework.generator.provider.db.table.model.Table;
import cn.org.rapid_framework.generator.util.GLogger;

/**
 * <b>function:</b>
 * 
 * @author hoojo
 * @createDate 2017-6-11 下午4:17:13
 * @file GeneratorTableListeners.java
 * @package com.cnblogs.hoojo.rapidframework.table
 * @project RapidFramework
 * @blog http://blog.csdn.net/IBM_hoojo
 * @email hoojo_@126.com
 * @version 1.0
 */
public class GeneratorTableListeners implements TableFactoryListener {

	public GeneratorTableListeners() {

		// 增加监听器,用于table的自定义className
		TableFactory tf = TableFactory.getInstance();
		tf.addTableFactoryListener(this);
	}

	@Override
	public void onTableCreated(Table table) {
		System.out.println("################################" + table.getColumns());
	}

	@Override
	protected void finalize() throws Throwable {
		super.finalize();
	
		GLogger.warn("没有手工清除TableFactoryListener for TableConfigSet");
		TableFactory.getInstance().removeTableFactoryListener(this);
	}
}
